package com.example.jvm.chapter02;

public class InternExample {
    public static void main(String[] args) {
        String s2 = "hello";
        String s1 = new String("hello");
        System.out.println(s1 == s2);
        System.out.println(s1.intern() == s2);
        String s3 = "hello";
        System.out.println(s2 == s3);
        String str1 = new StringBuilder("计算机软件").toString();
        System.out.println(str1.intern() == str1);
    }
}
